﻿using Dapper.Contrib.Extensions;
using Gx.Common;
using Gx.Model.Enums;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Gx.Model.Entity
{
    [System.ComponentModel.DataAnnotations.Schema.Table("LK_WarehouseContract")]
    public class LKWarehouseContract
    {
        [System.ComponentModel.DataAnnotations.Key]
        private int _id;
        /// <summary>
        /// Id
        /// </summary>
        [Column("Id")]
        public int Id
        {
            get
            {
                return _id;
            }
            set { _id = value; }
        }


        private string _contractNo;
        /// <summary>
        /// 合同编号
        /// </summary>
        [Column("ContractNo")]
        public string ContractNo
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_contractNo))
                    _contractNo = string.Empty;
                return _contractNo;
            }
            set { _contractNo = value; }
        }


        private int _customerId;
        /// <summary>
        /// 客户
        /// </summary>
        [Column("CustomerId")]
        public int CustomerId
        {
            get
            {
                return _customerId;
            }
            set { _customerId = value; }
        }

        private string _customerName;
        /// <summary>
        /// 客户名称
        /// </summary>
        [Column("CustomerName")]
        public string CustomerName
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_customerName))
                    _customerName = string.Empty;
                return _customerName;
            }
            set { _customerName = value; }
        }


        private System.DateTime _contractTime;
        /// <summary>
        /// 开单日期
        /// </summary>
        [Column("ContractTime")]
        public System.DateTime ContractTime
        {
            get
            {
                if (_contractTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _contractTime;
            }
            set { _contractTime = value; }
        }


        private System.DateTime _beginTime;
        /// <summary>
        /// 开始日期
        /// </summary>
        [Column("BeginTime")]
        public System.DateTime BeginTime
        {
            get
            {
                if (_beginTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _beginTime;
            }
            set { _beginTime = value; }
        }


        private System.DateTime _endTime;
        /// <summary>
        /// 结束日期
        /// </summary>
        [Column("EndTime")]
        public System.DateTime EndTime
        {
            get
            {
                if (_endTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _endTime;
            }
            set { _endTime = value; }
        }


        private int _storeType;
        /// <summary>
        /// 包仓类型
        /// </summary>
        [Column("StoreType")]
        public int StoreType
        {
            get
            {
                return _storeType;
            }
            set { _storeType = value; }
        }


        private int _storeAlgorithm;
        /// <summary>
        /// 包仓算法
        /// </summary>
        [Column("StoreAlgorithm")]
        public int StoreAlgorithm
        {
            get
            {
                return _storeAlgorithm;
            }
            set { _storeAlgorithm = value; }
        }


        private decimal _unitPrice;
        /// <summary>
        /// 单价
        /// </summary>
        [Column("UnitPrice")]
        public decimal UnitPrice
        {
            get
            {
                return _unitPrice;
            }
            set { _unitPrice = value; }
        }


        private int _number;
        /// <summary>
        /// 数量
        /// </summary>
        [Column("Number")]
        public int Number
        {
            get
            {
                return _number;
            }
            set { _number = value; }
        }


        private decimal _amount;
        /// <summary>
        /// 总金额
        /// </summary>
        [Column("Amount")]
        public decimal Amount
        {
            get
            {
                return _amount;
            }
            set { _amount = value; }
        }


        private bool _isByTon;
        /// <summary>
        /// 按吨操作
        /// </summary>
        [Column("IsByTon")]
        public bool IsByTon
        {
            get
            {
                return _isByTon;
            }
            set { _isByTon = value; }
        }


        private int _wareHouseId;
        /// <summary>
        /// 仓库
        /// </summary>
        [Column("WareHouseId")]
        public int WareHouseId
        {
            get
            {
                return _wareHouseId;
            }
            set { _wareHouseId = value; }
        }


        private string _remark;
        /// <summary>
        /// 备注
        /// </summary>
        [Column("Remark")]
        public string Remark
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_remark))
                    _remark = string.Empty;
                return _remark;
            }
            set { _remark = value; }
        }


        private bool _isValid;
        /// <summary>
        /// 是否停用
        /// </summary>
        [Column("IsValid")]
        public bool IsValid
        {
            get
            {
                return _isValid;
            }
            set { _isValid = value; }
        }


        private System.DateTime _createTime;
        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("CreateTime")]
        public System.DateTime CreateTime
        {
            get
            {
                if (_createTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _createTime;
            }
            set { _createTime = value; }
        }


        private int _createUserId;
        /// <summary>
        /// 创建人id
        /// </summary>
        [Column("CreateUserId")]
        public int CreateUserId
        {
            get
            {
                return _createUserId;
            }
            set { _createUserId = value; }
        }


        private string _createUser;
        /// <summary>
        /// 创建人
        /// </summary>
        [Column("CreateUser")]
        public string CreateUser
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_createUser))
                    _createUser = string.Empty;
                return _createUser;
            }
            set { _createUser = value; }
        }


        private int _modifyUserId;
        /// <summary>
        /// 修改人id
        /// </summary>
        [Column("ModifyUserId")]
        public int ModifyUserId
        {
            get
            {
                return _modifyUserId;
            }
            set { _modifyUserId = value; }
        }


        private string _modifyUser;
        /// <summary>
        /// 修改人
        /// </summary>
        [Column("ModifyUser")]
        public string ModifyUser
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_modifyUser))
                    _modifyUser = string.Empty;
                return _modifyUser;
            }
            set { _modifyUser = value; }
        }


        private System.DateTime _modifyTime;
        /// <summary>
        /// 修改时间
        /// </summary>
        [Column("ModifyTime")]
        public System.DateTime ModifyTime
        {
            get
            {
                if (_modifyTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _modifyTime;
            }
            set { _modifyTime = value; }
        }


        private bool _isDeleted;
        /// <summary>
        /// 是否删除
        /// </summary>
        [Column("IsDeleted")]
        public bool IsDeleted
        {
            get
            {
                return _isDeleted;
            }
            set { _isDeleted = value; }
        }

        private int _companyId;
        /// <summary>
        /// 公司
        /// </summary>
        [Column("CompanyId")]
        public int CompanyId
        {
            get
            {
                return _companyId;
            }
            set { _companyId = value; }
        }

        private int _status;
        /// <summary>
        /// 状态
        /// </summary>
        [Column("Status")]
        public int Status
        {
            get
            {
                return _status;
            }
            set { _status = value; }
        }

        [Computed]
        public string StatusName
        {
            get
            {
                return EnumHelper.GetDataTypeDescription<EntryBillStatus>(Status);
            }
        }

        [Computed]
        public string StoreTypeName //{ get; set; }
        {
            get
            {
                switch (StoreType)
                {
                    case 1:
                        return "包面积";
                    case 2:
                        return "包卡位";
                    default:
                        return "";
                }
            }
        }

        [Computed]
        public string StoreAlgorithmName //{ get; set; }
        {
            get
            {
                switch (StoreAlgorithm)
                {
                    case 1:
                        return "按自然月计算";
                    case 2:
                        return "按计费月计算";
                    case 3:
                        return "按自然天计算";
                    default:
                        return "";
                }
            }
        }
        [Computed]
        public string IsValidName
        {
            get
            {
                return IsValid ? "是" : "否";
            }
        }

        [Computed]
        public string WareHouseName { get; set; }
    }
}

